package edu.spec.dengyan.week08.class01.book.unit4.topic01;

/**
 * Author       : Dengyan
 * Date         : 2018/10/16 17:34
 * Description  : “Cylinder”类
 */
public class Cylinder extends Circle {
    private static final double Radius = 4;
    private double hight;
    public Cylinder(double r,double h){//创建Circle对象时，将半径初始化为r
        super(r);
        this.hight=h;
    }
    public double getVolume(){//获取圆柱形的体积
        return getHight()*getArea();
    }

    public double getHight() {
        return hight;
    }
    public void showVolume(){//将圆柱形的体积输出到屏幕
        System.out.println("圆柱形的体积是："+getVolume());
    }

    public static void main(String[] args) {
        Circle c=new Circle(4);
        Cylinder y=new Cylinder(4,8);
        c.show();
        y.showVolume();
    }
}
